package com.lvhx.constant;

public enum Weekday {
    ONE(1, "星期一"),
    TWO(2, "星期二"),
    THREE(3, "星期三"),
    FOUR(4, "星期四"),
    FIVE(5, "星期五"),
    SIX(6, "星期六"),
    SEVEN(7, "星期日");

    private int value;
    private String desc;

    Weekday(int value,String desc){
        this.value = value;
        this.desc = desc;
    }
    public int getValue(){
        return value;
    }
    public String getDesc(){
        return desc;
    }

    public static void main(String[] args) {
        Weekday[] weekdays = Weekday.values();
        for (int i = 0; i < weekdays.length; i++) {
            System.out.println(weekdays[i]);
            System.out.println(weekdays[i].value);
        }

        // 根据名称获取枚举
        Weekday monday = Weekday.valueOf("ONE");
        System.out.println(monday);

        System.out.println(monday.name());
        System.out.println(monday.ordinal());

        System.out.println(monday.compareTo(Weekday.TWO));
    }

}
